#! /bin/bash
#
# link.sh
# Copyright (C) 2020 zimingzpp <zimingzpp@qq.com>
#
#2020.6.15
#
# Distributed under terms of the MIT license.
#


passwd=gchaktd2020
for ip in `cat ip`
do 
expect <<EOF
spawn ssh-copy-id root@$ip
expect {
        "**yes/no*" { send "yes\r"; exp_continue}
        "password:" { send "$passwd\r"; exp_continue}
}
EOF
done

